home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
as02.arc
/
SUPEREN.ASM
< prev
next >
Wrap
Assembly Source File
|
1985-04-11
|
2KB
|
59 lines
page
page 72,120
title superen Change name of file,sub-dir or vol id.
comment " superen [d:]name1 name2
renames files or subdirectories from name1 to name2.
name1 & name2 may have extensions and wild characters.
action of the program is as described in the dos manual
for int 21, function 17.
"
com segment
assume cs:com,ds:com,es:com,ss:com
org 5ch ;fcb formed from name 1
fcb1 label byte
drive1 db ?
name1 db 11 dup(?)
org 6ch ;fcb formed from name 2
fcb2 label byte
drive2 db ?
name2 db 11 dup(?)
org 100h
superen proc
mov dx,offset invdr$ ;point to error msg
test al,al ;test for valid drive1 id
jnz error
mov dx,offset invpar$ ;check if name1 is there
cmp name1,' '
je error
cmp name2,' ' ;check for name2
je error
mov si,offset fcb1 ;point to name1 fcb
mov di,offset oldn ;point to old name field
mov cx,12 ;move 12 bytes
rep movsb ;move name1 to extended fcb
mov si,offset name2 ;point to name2 not drive
mov di,offset oldn+11h ;point to new name field
mov cx,11 ;name ex drive = 11 bytes
rep movsb ;move name2 to extended fcb
mov dx,offset xfcb ;point dx to extended fcb
mov ah,17h ;funtion 17 = rename
int 21h
test al,al ;test for errors
jz exit ;no errors if al=0
mov dx,offset invnam$ ;else point to error msg
error: mov ah,9 ;display error message
int 21h
exit: int 20h ;return to dos
superen endp
invdr$ db 0dh,0ah,'Invalid drive id$',0dh,0ah,'$'
invpar$ db 0dh,0ah,'2 params needed:[d:]oldname, newname'
db 0dh,0ah,'$'
invnam$ db 0dh,0ah,'Name not found or already exists'
db 0dh,0ah,'$'
xfcb db 0ffh ;extended fcb id byte
db 5 dup(0)
attr db 18h ;attr for sub-dirs & vol labels
oldn db 37 dup(0) ;old & new names go here
com ends
end superen